// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import Global from "../Global";
import ResMgr from "./ResMgr";

const {ccclass, property} = cc._decorator;

@ccclass
export default class LanPicSign extends cc.Component {//标记图片为多语言

    // LIFE-CYCLE CALLBACKS:
    @property(cc.SpriteAtlas)
    atlas:cc.SpriteAtlas;

    onLoad () {
        this.node.active = false;
        let picName = this.getComponent(cc.Sprite).spriteFrame.name;
        console.log("atlas file name:"+picName);
        let sprFrame = this.atlas.getSpriteFrame(Global.language+"_"+picName);
        this.getComponent(cc.Sprite).spriteFrame = sprFrame;
        this.node.active = true;
    }
}
